package ms.maplestory.boot.client;

import ms.maplestory.boot.client.character.Char;
import ms.maplestory.boot.connection.netty.NettyClient;
import ms.maplestory.boot.world.ChannelServer;
import lombok.Getter;
import lombok.Setter;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

@Getter
@Setter
public class Client extends NettyClient {

    private Lock lock;
    private Char chr;
    private Account account;
    private User user;
    private byte[] machineID;
    private int worldId;
    private int channelId;
    private ChannelServer channelServerInstance;


    public Client(io.netty.channel.Channel channel, byte[] sendSeq, byte[] recvSeq) {
        super(channel, sendSeq, recvSeq);
        lock = new ReentrantLock(true);
    }

    public void sendPing() {
        // 心跳包
    }

    @Override
    public String toString() {
        return getClass().getName() + "{" +
                "(" + super.toString() +
                ")chrId=" + chr.getId() +
                ", accountId=" + account.getId() +
                ", user=" + user.getId() +
                ", worldId=" + worldId +
                ", channelId=" + channelId +
                '}';
    }
}
